<?php 
$create_app_id=Yii::app()->params['create_app_id'];
$cs=Yii::app()->clientScript;
$cs->registerScript('schedule_to_appointment',<<<END
$(".schedule_to_appointment").click(
function(){
	var exists=true;
	var tab=parent.tab;
	var n = tab.getComponent('$create_app_id');
	if(n){
		exists=confirm('添加派车单窗口已存在，是否关闭已有窗口进行添加?');
		if(exists) tab.remove('$create_app_id');
		//else  tab.setActiveTab('$create_app_id');
	}
	if(exists){
		n = tab.add({'id':'$create_app_id','title':'添加派车单',	closable:true,height:'100px',
            html: "<iframe class='$create_app_id' scrolling='auto' frameborder='0' width='100%' height='100%' src='?r=truck_appointment/create&sid=$model->id'></iframe>"});
        tab.setActiveTab(n);  
	}
}
);
END
);
?>
<h2>货主为<?php echo $model->consignor_name; ?>的作业计划单</h2>

<div class="actionBar1">
<?php 
	if(isset($_GET['ok'])) {if($_GET['ok']==0) $mess='添加成功！'; else $mess='更新成功！';unset($_GET['ok']);}//判断添加/更新信息
	$act=isset($_GET['ret'])?$_GET['ret']:$ret;//判断show以后返回路径
	unset($_GET['ret']);unset($_GET['id']);
	$url=substr($act,-5)=='.html'?$act:array($act)+$_GET;//返回路径以html结尾,act将普通变量赋值
?>
[<?php echo CHtml::link('导入派车单','#',array('class'=>'schedule_to_appointment')); ?>]&nbsp;&nbsp;&nbsp;&nbsp;
[<?php echo CHtml::link('返回',$url,array('class'=>'return_btn')); ?>]
</div>

<table class="dataGrid" width="80%">
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('consignor_name')); ?>
</th>
    <td><?php echo CHtml::encode($model->consignor_name); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('deliver_place')); ?>
</th>
    <td><?php echo CHtml::encode($model->deliver_place); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('arrival_place')); ?>
</th>
    <td><?php echo CHtml::encode($model->arrival_place); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('mileage')); ?>
</th>
    <td><?php echo CHtml::encode($model->mileage); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('deliver_time')); ?>
</th>
    <td><?php echo CHtml::encode(substr($model->deliver_time,0,16)); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('arrival_time')); ?>
</th>
    <td><?php echo CHtml::encode(substr($model->arrival_time,0,16)); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('goods_name')); ?>
</th>
    <td><?php echo CHtml::encode($model->goods_name); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('unit_name')); ?>
</th>
    <td><?php echo CHtml::encode($model->getUnitName()); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('unit_price')); ?>
</th>
    <td><?php echo CHtml::encode($model->unit_price); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('amount')); ?>
</th>
    <td><?php echo CHtml::encode($model->amount); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('freight_charge')); ?>
</th>
    <td><?php echo CHtml::encode($model->freight_charge); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('distributor')); ?>
</th>
    <td><?php echo CHtml::encode($model->distributor); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('user_name')); ?>
</th>
    <td><?php echo CHtml::encode($model->user_name); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('user_region')); ?>
</th>
    <td><?php echo CHtml::encode($model->user_region); ?>
</td>
</tr>
<tr>
	<th class="label"><?php echo CHtml::encode($model->getAttributeLabel('create_time')); ?>
</th>
    <td><?php echo CHtml::encode($model->create_time); ?>
</td>
</tr>
</table>
<?php if(isset($mess)) echo "<script>alert('$mess');</script>";?>
<div class="actionBar1">
[<?php echo CHtml::link('导入派车单','#',array('class'=>'schedule_to_appointment')); ?>]&nbsp;&nbsp;&nbsp;&nbsp;
[<?php echo CHtml::link('返回',$url); ?>]
</div>